package com.hxy.ssm.service.impl;

import com.hxy.ssm.bean.EmployeeExample;
import com.hxy.ssm.bean.User;
import com.hxy.ssm.bean.UserExample;
import com.hxy.ssm.mapper.UserMapper;
import com.hxy.ssm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper usermapper;

    @Override
    public boolean findUserByName(String username,String password) {
        UserExample example=new UserExample();
        UserExample.Criteria criteria=example.createCriteria();
        criteria.andUsernameEqualTo(username);
        List<User> userList=usermapper.selectByExample(example);
        if(userList.size()>0){
            User user=userList.get(0);
            String pwd=user.getPassword();
            if(pwd.equals(password)){
                return true;
            }
        }
        return false;
    }
}
